﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ReconSite.Master" AutoEventWireup="true" CodeBehind="CustomerMaster.aspx.cs" Inherits="ReconUI.CustomerMaster" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleHolder" runat="server">
    <title>Customer Maintenance</title>
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyHolder" runat="server">
    <div class="formDiv" style="width:60%">
    <h2 class="formTitle">Customer Master</h2>
    <h1 class="formError" style="text-align:right;font-size:smaller;color:#CC2900;">Fields marked with * are mandatory</h1>
	<%--<span id="mandatoryMessage" class="formError">Fields marked with * are mandatory</span>--%>
    <table cellspacing="1" cellpadding="1" border="0" width = "100%">
       <tr>
                <td align="right">
                    Option<span class="required">*</span></td>
                <td  colspan="3">                    
                    <asp:RadioButtonList ID="rbOption" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                    <asp:ListItem Value="1" Selected="True">Add</asp:ListItem>
                    <asp:ListItem Value="2">Modify</asp:ListItem>
                    </asp:RadioButtonList>
                    <%--<asp:DropDownList ID="ddlOption" runat="server" 
                        AutoPostBack="false">
                        <asp:ListItem Value="0">Please Select</asp:ListItem>
                        <asp:ListItem Value="1">Add</asp:ListItem>
                        <asp:ListItem Value="2">Modify</asp:ListItem>
                    </asp:DropDownList>--%>
                    <%--<asp:RequiredFieldValidator ID="reqOption" runat="server" 
                        ErrorMessage="Mandatory" CssClass="formError"
                        ControlToValidate="ddlOption" InitialValue="0" 
                        SetFocusOnError="True"></asp:RequiredFieldValidator>--%></td>
        </tr>
        <tr>
            <td align="right">
                Customer ID<span class="required">*</span>
            </td>
            <td colspan="3">
                <asp:TextBox ID="txtCustomerId" runat="server" MaxLength="10"></asp:TextBox>
                <asp:Button ID="bntbrowse" runat="server" Text="..." Width="25px"   OnClick="bntbrowse_Click" CausesValidation="False" />
                <asp:Button ID="bntgetdetails" runat="server" Text="Get Details" OnClick="bntgetdetails_Click" CausesValidation="False" OnClientClick="javascript:return SelectUser();" />
                <asp:RequiredFieldValidator ID="reqCusId" runat="server" 
                    ErrorMessage="Customer Id is Mandatory" CssClass="formError"
                    ControlToValidate="txtCustomerId" InitialValue="" 
                    SetFocusOnError="True"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regCusId" runat="server" 
                    ControlToValidate="txtCustomerId" CssClass="formError"
                    ErrorMessage="Invalid Customerid" ValidationExpression="^[0-9a-zA-Z]+$" 
                    SetFocusOnError="True"></asp:RegularExpressionValidator>
            </td>
        </tr>       
        <tr>
            
            <td align="right">
                Name<span class="required">*</span>
            </td>
            <td  colspan="3">
                <asp:TextBox ID="txtName" runat="server" MaxLength="100"></asp:TextBox>
               <asp:RequiredFieldValidator ID="reqName" runat="server" 
                    ErrorMessage="Customer Name is mandatory" CssClass="formError"
                    ControlToValidate="txtName" SetFocusOnError="True"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regName" runat="server" 
                    ErrorMessage="Invalid name" CssClass="formError"
                    ControlToValidate="txtName" SetFocusOnError="True" 
                    ValidationExpression="^[a-zA-Z' '.]+$"></asp:RegularExpressionValidator>
                
            </td>
        </tr>
        
        <tr>
            <td align="right">
                Address1<span class="required">*</span>
            </td>
            <td>
                <asp:TextBox ID="txtAddress1" runat="server" MaxLength="50"></asp:TextBox>
                <asp:RequiredFieldValidator ID="reqAddress1" runat="server" 
                    ErrorMessage="Address1 is mandatory" CssClass="formError"
                    ControlToValidate="txtAddress1" SetFocusOnError="True"></asp:RequiredFieldValidator>                    
            </td>
            <td align="right">
                Address2<span class="required">*</span>
            </td>
            <td>
                <asp:TextBox ID="txtAddress2" runat="server" MaxLength="50"></asp:TextBox>
               <asp:RequiredFieldValidator ID="reqaAddress2" runat="server" 
                    ErrorMessage="Address2 is mandatory" CssClass="formError"
                    ControlToValidate="txtAddress2" SetFocusOnError="True"></asp:RequiredFieldValidator>
                    
            </td>
        </tr>
       
        
        <tr>
          <td align="right">City<span class="required">*</span></td>
            <td> 
                <asp:TextBox ID="txtCity" runat="server" MaxLength="35"></asp:TextBox>
                <asp:RequiredFieldValidator ID="reqtxtCity" runat="server" 
                    ErrorMessage="City is mandatory" CssClass="formError"
                    ControlToValidate="txtCity" SetFocusOnError="True"></asp:RequiredFieldValidator>
               <asp:RegularExpressionValidator ID="regCity" runat="server" 
                    ControlToValidate="txtCity" CssClass="formError" 
                    ErrorMessage="Invalid city" SetFocusOnError="True" 
                    ValidationExpression="^[a-zA-Z' ']+$"></asp:RegularExpressionValidator>
              </td>
              <td align="right">State<span class="required">*</span></td>
            <td >  <asp:TextBox ID="txtState" runat="server" MaxLength="35"></asp:TextBox> 
                <asp:RequiredFieldValidator ID="reqState" runat="server" 
                    ErrorMessage="State is mandatory" CssClass="formError"
                    ControlToValidate="txtState" SetFocusOnError="True"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regState" runat="server" 
                    ControlToValidate="txtState" CssClass="formError" 
                    ErrorMessage="Invalid State" SetFocusOnError="True" 
                    ValidationExpression="^[a-zA-Z' ']+$"></asp:RegularExpressionValidator>               
            </td>  
        </tr>
        <tr>
            <td align="right">
                Zip Code
            </td>
            <td >
                <asp:TextBox ID="txtZipCode" runat="server" MaxLength="10"></asp:TextBox>
                <asp:RegularExpressionValidator ID="regZipCode" runat="server" 
                    ErrorMessage="Invalid zip code" CssClass="formError"
                    ControlToValidate="txtZipCode" SetFocusOnError="True" 
                    ValidationExpression="^[1-9][0-9]{1,}$"></asp:RegularExpressionValidator>              
                
            </td>
            <td align="right">Country<span class="required">*</span></td>
            <td >
                <asp:TextBox ID="txtCountry" runat="server" MaxLength="35"></asp:TextBox>
                <asp:RequiredFieldValidator ID="reqCountry" runat="server" 
                    ErrorMessage="Country is mandatory" CssClass="formError"
                    ControlToValidate="txtCountry" SetFocusOnError="True" 
                        ></asp:RequiredFieldValidator>  
                <asp:RegularExpressionValidator ID="regCountry" runat="server" 
                    ControlToValidate="txtCountry" CssClass="formError" 
                    ErrorMessage="Invalid country" SetFocusOnError="True" 
                    ValidationExpression="^[a-zA-Z' ']+$"></asp:RegularExpressionValidator>
               
              </td>
        </tr>
       
        <tr>
            <td align="right">Phone</td>
            <td ><asp:TextBox ID="txtPhone" runat="server" Height="22px" MaxLength="15"></asp:TextBox>
                <asp:RegularExpressionValidator ID="regPhone" runat="server" 
                    ErrorMessage="Invalid phone" CssClass="formError"
                    ControlToValidate="txtPhone" SetFocusOnError="True" 
                    ValidationExpression="^[0-9]{1,}$"></asp:RegularExpressionValidator>
            </td>
            <td align="right">
                Email
            </td>
            <td  colspan="3">
                <asp:TextBox ID="txtEmail" runat="server" MaxLength="100"></asp:TextBox>
                <asp:RegularExpressionValidator ID="regTxtEmail" runat="server" 
                    ErrorMessage="Invalid email" CssClass="formError"
                    ControlToValidate="txtEmail" SetFocusOnError="True" 
                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
            </td>
        </tr>
        
        <tr>
            <td align="right">
            </td>
            <td  colspan="3">
                
                <asp:CheckBox ID="chkIsenabled" runat="server" Checked="True" Text="Enable" />
                
            </td>
        </tr>
       
        <tr>
            <td >
                &nbsp;
            </td>
            <td  colspan="3">
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click"/>
                &nbsp;&nbsp;<asp:Button ID="btnCancel" runat="server" Text="Reset" CausesValidation="False" 
                     onclick="btnCancel_Click" />
            </td>
        </tr>

           </table>

   <asp:UpdatePanel ID="upUnmatchedLists" runat="server" UpdateMode="Conditional">
        <ContentTemplate>    
                <div id="pnlMatchList" runat="server" class="pnlMatchList">    
                    <span style="azimuth: center;">
                        <div id="Div1" class="formDiv" runat ="server"  >
                            <center>
                                <asp:Label ID="lblMessage" runat="server"    CssClass="lable"/>
                            </center>
                        </div>
                    </span>
                    <div class="formDiv" style="width: 30%;">
                         <center>
                            <asp:Button ID="btnok" runat="server" Text="OK" onclick="btnok_Click" CausesValidation="False"  />
                          </center>
                    </div>
                </div>
            <div style="display: none">
                <asp:Button ID="btnManualPopup" runat="server" />
            </div>
            <ajax:ModalPopupExtender ID="btnClickPopup" runat="server" PopupControlID="pnlMatchList"
                TargetControlID="btnManualPopup" BackgroundCssClass="modalBackground" RepositionMode="RepositionOnWindowScroll" OkControlID = "btnok">
            </ajax:ModalPopupExtender>   
        </ContentTemplate>        
    </asp:UpdatePanel>
           </div>

            <script type="text/javascript">


                function SelectUser() {
                    var Username = document.getElementById('<%=txtCustomerId.ClientID %>').value;
                    if (Username == '') {
                        alert("Customer Id is Mandatory");
                        return false;
                    }

                    return true;
                }
    </script>
</asp:Content>
